package com.itany.corejava.day06;

public class Test2 {

    public static void main(String[] args) {
        //栈里定义变量
        Person p;
        /*
            1.堆里分配空间
            2.初始化属性
            3.调用构造方法
         */
        p=new Person("abc",true);

        System.out.println("p = " + p);

        p.eat("肉");

        p.sleep();
        //
        // System.out.println("p.name = " + p.name);
        // System.out.println("p.age = " + p.age);
        // System.out.println("p.sex = " + p.sex);
        // System.out.println("p.money = " + p.money);
        // System.out.println("p.心 = " + p.心);


        Person p2=new Person(false);
        System.out.println("p2 = " + p2);


        // p.name="aaa";
        //
        // System.out.println("p.name = " + p.name);

        System.out.println(p.getName());

        // System.out.println(p.age);
        //
        // p.age=-23;
        //
        // System.out.println(p.age);
        
        p.setAge(-32);

        System.out.println("p.getAge() = " + p.getAge());

        System.out.println("p.getName() = " + p.getName());

        System.out.println("p.getSex() = " + p.getSex());
    }


}
